rerun_if_changed: Vec::new(),
warnings: Vec::new(),
};
+ // We require deterministic order of evaluation, so we must sort the pairs by key first.
+ let mut pairs = Vec::new();
for (k, value) in value.table(&lib_name)?.0 {
+ pairs.push((k,value));
+ }
+ pairs.sort_by_key( |p| p.0 );
+ for (k,value) in pairs{
let key = format!("{}.{}", key, k);
match &k[..] {
"rustc-flags" => {
output.metadata.push((k.clone(), val.to_string()));
}
}
-
- // We randomized the data source with HashMaps, so we must sort the resulting vectors
- // to produce a deterministic result
- output.sort();
}
ret.overrides.insert(lib_name, output);
}
}
Ok((library_paths, library_links))
}
-
- /// Sort the contents of the struct for consistent hashing.
- /// Suggested if populated from a HashMap instead of an order-preserving data source
- pub fn sort(&mut self){
- self.library_paths.sort();
- self.library_links.sort();
- self.cfgs.sort();
- self.metadata.sort();
- self.rerun_if_changed.sort();
- self.warnings.sort();
- }
}
/// Compute the `build_scripts` map in the `Context` which tracks what build
[..]
[..]
[..]
-[RUNNING] `rustc --crate-name foo [..] -L bar -L foo`
+[RUNNING] `rustc --crate-name foo [..] -L foo -L bar`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
"));
}